<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%><%-- ${fn:length(list)} --%>
<script src="jquery-1.7.2.js" type="text/javascript" charset="utf-8"></script>
<script>
	
	$(document).ready(function(){
		$("#box_update").click(function(){
			$.ajax({
				type:"post",
				url:"admin.do",
				data:"command=updateBoxOffice",
				success:function(data){
					alert("박스오피스 업데이트 완료!");
					var table="";
					table+="<table border='1' cellspacing='0'>";
					table+="<tr><td> 박스오피스 </td><td colspan='2'><input type='button' id='box_update' value='update'></td></tr>";
					table+="<tr><td> 순위 </td><td> 영화제목 </td><td> 누적관객수 </td></tr>";
					$.each(data.list,function(indexl,value){
						table+="<tr align='center'><td>"+value.RK+"</td><td>"+value.MOVIE_TITLE+"</td><td>"+value.TOTAL_MEMBER+"</td></tr>";
					});
					table+="</table>";
					$("#boxlist").html(table);
				}
			})
		});
	});

</script>
<c:choose>
<c:when test="${sessionScope.vo.memberlevelinfoVO.member_level_no !=1}">
<script>
	alert("잘못된 접근입니다!");           
	location.href="mycinema.do?command=home_main";
</script>
</c:when>
<c:when test="${sessionScope.vo.memberlevelinfoVO.member_level_no ==1}">
<font class="title">박스오피스 업데이트</font><hr color="#f5f5f5">
<div id="boxlist">
<table border='1' cellspacing="0">
	<tr>
		<td> 박스오피스 </td>
		<td colspan='2'><input type="button" id="box_update"value="update"></td>
	</tr>
	<tr align='center'>
		<td> 순위 </td>
		<td> 영화제목 </td>
		<td> 누적관객수 </td>
	</tr>
	<c:forEach items="${requestScope.list}" var="list">
	<tr align='center'>	
		<td>${list.RK}</td>
		<td>${list.MOVIE_TITLE}</td>
		<td>${list.TOTAL_MEMBER}</td>
	</tr>
	</c:forEach>		
</table>
</div>
</c:when>
</c:choose>
